home *** CD-ROM | disk | FTP | other *** search
- unit ComboFx;
-
- interface
-
- uses
- StdCtrls;
-
- type
- TComboBoxFix = class(TComboBox)
- private
- function GetSelLength: Integer;
- function GetSelStart: Integer;
- procedure SetSelLength(Value: Integer);
- procedure SetSelStart(Value: Integer);
- public
- property SelLength: Integer read GetSelLength write SetSelLength;
- property SelStart: Integer read GetSelStart write SetSelStart;
- end;
-
- procedure Register;
-
- implementation
-
- uses
- Messages,
- Windows,
- SysUtils,
- LibConst,
- Classes;
-
- type
- TWordSelection = packed record
- StartPos: word;
- EndPos : word;
- end;
-
- function TComboBoxFix.GetSelLength: Integer;
- begin
- Result := inherited SelLength;
- end;
-
- function TComboBoxFix.GetSelStart: Integer;
- begin
- Result := inherited SelStart;
- end;
-
- procedure TComboBoxFix.SetSelStart(Value: Integer);
- var
- Selection: TWordSelection;
- begin
- Selection.StartPos := Value;
- Selection.EndPos := Selection.StartPos + SelLength;
- SendMessage(Handle, CB_SETEDITSEL, 0, Longint(Selection));
- end;
-
- procedure TComboBoxFix.SetSelLength(Value: Integer);
- var
- Selection: TWordSelection;
- begin
- Selection.StartPos := SelStart;
- Selection.EndPos := Selection.StartPos + Value;
- SendMessage(Handle, CB_SETEDITSEL, 0, Longint(Selection));
- end;
-
- procedure Register;
- begin
- RegisterComponents(LoadStr(srStandard), [TComboBoxFix]);
- end;
-
- end.
-